<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../share/taglib.jsp" %>
<%@ include file="../share/isReadOnly.inc" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>留言<bean:message key="display.manage"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<script type="text/javascript" src="/js/jquery-1.3.1.min.js"></script>
<script language="JavaScript">
//到指定的分页页面
function topage(page){
	var form = document.forms[0];
	form.page.value = page;
	form.submit();
}
function markMessage(index) {
	$.post("/cms/message.do", {
		method : "mark",
		messageId : index
	}, function(data, textStatus) {
		var msgId = data.messageId;
		if (data.success) {
			var obj = document.getElementById('isReadDiv'+msgId);
			if (obj) {
				obj.innerHTML = '是';
			}
		} else {
			alert('标志留言已读失败');
		}
	}, "json");
}
function delMsg(msgId) {
	if(!confirm('你确定要删除该留言吗？')) {
		return false;
	}
	window.location.href = "<%=basePath%>cms/message.do?method=delete&messageId=" + msgId;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0">
<html:form action="/cms/message.do" method="post">
<html:hidden property="page"/>
<html:hidden property="method" value="list"/>
<table width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
    <tr><td colspan="5" bgcolor="#ffbe26" align="right">
    	<%@ include file="../share/fenye.jsp" %>
	</td></tr>
    <tr>
	  <td width="25%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000">留言时间</font></div></td>
      <td width="60%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">留言内容</font></div></td>
      <td width="5%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000">是否已读</font></div></td>
      <td width="5%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000">标记为已读</font></div></td>
      <td width="5%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000"><bean:message key="display.delete"/></font></div></td>
    </tr>
<!---------------------------LOOP START------------------------------>
<c:forEach items="${pageView.records}" var="entry">
    <tr>
      <td bgcolor="f5f5f5"><div align="center">${entry.createTime}</div></td>
      <td bgcolor="f5f5f5"><div align="center">${entry.content}</div></td>
      <td bgcolor="f5f5f5"><div align="center" id="isReadDiv${entry.messageId}">${entry.read ? "是" : "否"}</div></td>
      <td bgcolor="f5f5f5"><div align="center"><img src="/images/edit.gif" onclick="markMessage(${entry.messageId});" style="cursor:hand;" width="15" height="16" border="0" /></div></td>
	  <td bgcolor="f5f5f5"><div align="center">
	  <% if (isReadOnly) { %>
	  	<img src="/images/delete.gif" style="cursor:hand;" width="15" height="16" border="0" />
	  <% } else { %>
	  	<img src="/images/delete.gif" width="15" height="16" style="cursor:hand;" border="0" onclick="delMsg(${entry.messageId});"></div>
	  <% } %>
	  </td>
	</tr>
</c:forEach>
<!----------------------LOOP END------------------------------->
</table>
</html:form>
</body>
</html>